package cn.ronghuanet.auth.listener;

import cn.ronghuanet.auth.service.IPermissionScanService;
import cn.ronghuanet.auth.service.IPermissionService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener // 将这个监听器交给spring管理
public class PermissionListener implements ServletContextListener {
    @Autowired
    private IPermissionScanService permissionScanService;

    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        System.out.println("========================开始权限扫描========================");
        permissionScanService.scan();
        System.out.println("========================结束全线扫描========================");
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {

    }
}
